package com.poetize.plus.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.poetize.plus.entity.dao.ChildCommentCount;
import com.poetize.plus.entity.dao.CommentCountDAO;
import com.poetize.plus.entity.dao.CommentFloorDAO;
import com.poetize.plus.entity.po.Comment;
import com.poetize.plus.utils.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;
import java.util.Optional;

/**
 * @author zuosy
 * @created 2024/4/3 14:09
 */
public interface CommentMapper extends BaseMapper<Comment> {

    /**
     * 查询文章评论最大楼层
     * @param articleId
     * @return
     */
    Integer selectMaxFloorNum(@Param("articleId") Long articleId);

    /**
     * 查询文章下楼主分页
     * @param start
     * @param limit
     * @return
     */
    List<CommentFloorDAO> selectParentComment(@Param("articleId") Long articleId, @Param("start") Long start, @Param("limit") Long limit);

    /**
     * 查询文章下各楼层有多少条子评论
     * @param floors
     * @return
     */
    List<ChildCommentCount> selectChildCommentCount(@Param("articleId") Long articleId, @Param("floors") List<Integer> floors);

    /**
     * 查询文章下楼主评论
     * @return
     */
    CommentFloorDAO selectParentCommentByFloor(@Param("articleId") Long articleId, @Param("floor") Integer floor);

    /**
     * 查询文章下某楼层子评论
     *
     * @param floor
     * @param start
     * @param limit
     * @return
     */
    List<CommentFloorDAO> selectChildComment(@Param("articleId") Long articleId, @Param("floor") Integer floor, @Param("start") Long start, @Param("limit") Long limit);
}
